#!/usr/bin/perl -w

use strict;
use autodie;

# my $items=  s/\t$/\n/, "@ARGV";
# print $items;

$#ARGV < 1 and die "$0 in_file item\(s\).\n";

open my $vcf, $ARGV[0] or die "Can not open file.\n";

my $args="@ARGV[1..$#ARGV]";
$args =~ s/ /\t/g;
print "$args\n";


while (<$vcf>) {

	unless (/^#/) {
	
	my $info=$_;
	
		foreach (@ARGV[1..($#ARGV-1)]) { # if $#ARGV <= 1, do nothing
		
			if ($info =~ /(\t|\;)$_\=(.+?)(\;|\t)/) { # match a=x;
				print "$2\t";
			}elsif ($info =~ /(\t|\;)$_(\t|\;)/){ # match a;
				print "$_\t";
			}else { # match no a;
				print "\t";
			}

			
		}
		
		if ($info =~ /(\t|\;)$ARGV[$#ARGV]\=(.+?)(\;|\t)/) {
			print "$2\n";
		}elsif ($info =~ /(\t|\;)$ARGV[$#ARGV](\t|\;)/){
			print "true\n";
			
		}else {
			print "\n";
		}
		
		
		
	}

}

close $vcf;